package com.ossean.match.utils;

//用于计算加权后的匹配得分
public class ScoreHelper {

	/*
	 * 用来表示匹配类型，一方面用于计算匹配得分，
	 * 另一方面在后续的处理的时候还可以用于对帖子分类
	 */
	public enum MatchType {
		PrjTagsPostTile,PrjTagsPostTags,
		PrjNamePostTitle,PrjNamePostTags
		
	}
	//各种匹配对应的权重数
	
	private static float WeightPrjTagsPostTile = 1.0F;
	private static float WeightPrjTagsPostTags = 1.0F;
	private static float WeightPrjNamePostTitle = 1.0F;
	private static float WeightPrjNamePostTags = 1.0F;
	//根据匹配的类型 来对原始得分进行加权
	public static float getScore(MatchType matchType, float initScore) {
		float weight = 0;
		switch(matchType){
		case PrjTagsPostTile:
			weight = WeightPrjTagsPostTile;
			break;
		case PrjTagsPostTags:
			weight = WeightPrjTagsPostTags;
			break;
		case PrjNamePostTitle:
			weight = WeightPrjNamePostTitle;
			break;
		case PrjNamePostTags:
			weight = WeightPrjNamePostTags;
			break;
		}
		return weight * initScore;
	}

}
